<?php declare(strict_types = 1);

namespace Gnway\Ticket\Rest\Annotation;

use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\Annotation\Attribute;
use Doctrine\Common\Annotations\Annotation\Attributes;

/**
 * Controller Annotation
 *
 * @Annotation
 * @Target("CLASS")
 * @Attributes({
 *     @Attribute("prefix", type="string"),
 *     @Attribute("suffix", type="string"),
 * })
 * @author zushaolong
 * @mail zushaolong@gmail.com
 */
final class Controller
{

  /**
   * Route group prefix for the controller
   *
   * @var string
   */
  private string $prefix = '';

  /**
   * Route group suffix for the controller
   *
   * @var string
   */
  private string $suffix = '';

  /**
   * Controller constructor.
   *
   * @param array $values
   */
  public function __construct(array $values)
  {
    if (isset($values['value'])) {
      $this->prefix = $values['value'];
    }
    if (isset($values['prefix'])) {
      $this->prefix = $values['prefix'];
    }
    if (isset($values['suffix'])) {
      $this->suffix = $values['suffix'];
    }
  }

  /**
   * Fetch prefix value
   *
   * @return string
   */
  public function getPrefix(): string
  {
    return $this->prefix;
  }

  /**
   * Fetch suffix value
   *
   * @return string
   */
  public function getSuffix(): string
  {
    return $this->suffix;
  }
}